package com.woniuxy.creditsystem.statisticsmag.controller;

import com.github.pagehelper.PageInfo;
import com.woniuxy.creditsystem.common.bean.FinanceInfo;
import com.woniuxy.creditsystem.statisticsmag.page.PageRequest;
import com.woniuxy.creditsystem.statisticsmag.page.TableResult;
import com.woniuxy.creditsystem.statisticsmag.service.IFinanceService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 财务统计controller
 * @author 刘川
 *
 */
@RequestMapping("/fin")
@RestController
public class FinanceController {
    @Resource
    private IFinanceService iFinanceServiceImpl;

    @GetMapping (value="/page", produces = {"application/json;charset=utf-8"})
    public TableResult<FinanceInfo> findAllByParams(PageRequest request, FinanceInfo financeInfo){
        System.out.println(request);
        System.out.println(financeInfo);

        PageInfo<FinanceInfo> pageInfo = iFinanceServiceImpl.findAllByParams(request,financeInfo);
        System.out.println(pageInfo);
        return new TableResult<FinanceInfo>(pageInfo.getTotal(),pageInfo.getList());
    }
}
